home *** CD-ROM | disk | FTP | other *** search
- page 60,132
- comment /:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
- This is from Ashton-Tate's technotes, October 1985. I left
- out a few lines I thought were superfluous and changed a couple
- of things, but by and large it is the same. If
- you change "com" to 1 and "d3dr" to 0 you will get a com file
- which is virtually useless because ^c will knock it out, and
- if the printer is actually broken that will be the only way to
- escape short of a boot, which may corrupt any open index files.
-
- I don't think there really is any good way for a dbIII prog. to
- check the printer if you're working with pre-1.2, and I have
- stooped to using such workarounds as a batch file like this:
- do while .t.
- run prcheck
- if file('PR.BAD')
- option = ' '
- do while at(option,'RT')=0
- @1,0 say 'Printer off-line, R)eturn to main menu, T)ry again' get option picture '!'
- read
- enddo
- if option = 'R'
- clos data
- return to master
- endif
- else
- exit
- endif
- enddo
-
- rem prcheck.bat
- del PR.BAD
- prncheck (diff. prog., sets errorlevel to 1 if not ok)
- if errorlevel 1 echo>PR.BAD
- exit
-
- And then if you don't want the screen to be screwed up,
- you have to patch command.com to have echo off all the time.
- ...anyway, now with v. 1.2, "run prcheck" is replaced with
- pr_on = .f.
- call prncheck with pr_on
- and the "if file..." is replaced with "if .not. pr_on",
- which is much more satisfactory (quicker!)
-
- to use, assemble and link, then convert either to a .bin file or
- .com. file with exe2bin, and from v. 1.2 use "load prncheck(.bin)"
-
- Russell Freeland
- 305-764-1204 (voice only at present)
- Ft. Lauderdale, FL 33315
- 11-2-85
-
- ** please pardon the tabs in the text, I created it with **
- ** medit, but I checked, WS reads it OK **
-
- ONE FINAL NOTE: THERE ARE A FEW CHANGES MARKED IN CAPITALS
- WHICH WERE GIVEN TO ME BY RALPH DAVIS OF
- ASHTON-TATE WHEN I CALLED HIM ABOUT INCORRECT
- RESULTS ON THE AT. WORKS WELL NOW, HOWEVER,
- I NEVER GET ANY MESSAGE EXCEPT 'PRINTER TURNED
- OFF' FROM THE COM PROGRAM. ON MY AT, WHICH IS
- DEFINITELY A NON-STANDARD SETUP, I GET 04CH IN
- AX AFTER THE IN INSTRUCTION (048H AFTER ANDING
- IT WITH 0F8H) WHEN THE "SELECT" BUTTON IS OFF,
- WHICH I ALWAYS THOUGHT MEANT THE SAME AS OFF-LINE.
- WHEN THE PRINTER IS NOT CONNECTED I GET FC (:=F8).
- PLAY AROUND ON YOUR MACHINE AND LET ME KNOW IF YOU
- GET DIFFERENT RESULTS, PLEASE. YOU CAN CALL ME OR
- LEAVE A MESSAGE ON DARWIN BBS, 301-251-9206.
- THANX.
-
- ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-
- /
-
- com equ 0 ;not for .com file this time,
- d3dr equ 1 ;rather for dbIII dev. release
- true equ 1
- false equ 0
- ;
- codeseg segment byte public 'code'
- assume cs:codeseg,es:codeseg
-
- prntchk proc far
- if com
- org 100h
- endif
- ;
- ;
- start: jmp begin
- ;
- messg1 db 'printer off-line - please adjust and press any key','$'
- messg2 db 'printer not turned on - please turn it on and press any key','$'
- ok db ?
- crlf db 0dh,0ah,'$' ;car. return & linefeed
- pr_str equ 09h ;DOS function call to print string
-
- ;
- begin:
- push ax
- push bx
- push ds
- push es
- push cs
- pop es
- mov ax,40h ;point to sys. data seg.
- mov ds,ax
- mov si,8 ;and to lpt1 port addr.
- mov dx,[si] ;load pa into dx
- inc dx ;point to status port
- in al,dx ;and read it
- AND AL,0F8H ;THIS LINE IS CORRECTED FROM TECHNOTES
- ;TO TURN OFF BITS THAT DIFFER FROM AT TO PC
- cmp al,0D8H ;printer ok? THIS LINE DIFFERENT TOO!
- jne off_line ;no, check for off-line
- mov es:ok,true ;yes, ok=true
- jmp short exit
- off_line:
- cmp al,0C8H ;THIS ONE IS ALSO CORRECTED
- jne turned_off
- mov es:ok,false
- if com
- mov dx,offset messg1
- call printmessg
- pop es
- pop ds
- pop bx
- pop ax
- call wait ;await keypress
- mov dx,offset crlf
- call printmessg
- jmp begin
- endif
- jmp short exit
- turned_off:
- mov es:ok,false
- if com
- mov dx,offset messg2
- call printmessg
- pop es
- pop ds
- pop bx
- pop ax
- call wait ;await keypress
- mov dx,offset crlf
- call printmessg
- jmp begin
- endif
- exit:
- pop es
- pop ds
- pop bx
- if d3dr
- mov al,es:ok ;move .t. or .f. to
- mov byte ptr [bx],al ;db3 variable
- endif
- pop ax
- if com
- int 20h
- else
- ret
- endif
- ;
- prntchk endp
- ;==================================
- ; subroutines ====================
- ;==================================
- ;
- printmessg proc near
- push ax
- push ds ;save registers
- mov ax,es ;es points to prncheck's data
- mov ds,ax
- xor ax,ax ;zero ax
- mov ah,pr_str ;print string function
- int 21h
- pop ds
- pop ax
- ret
- printmessg endp
- ;
- wait proc near
- push ax
- mov ah,1
- int 21h
- pop ax
- ret
- wait endp
- ;===================
- codeseg ends
- end start